
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>单例模式 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="建造者模式.html" />
    
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../android/">
            
                <a href="../android/">
            
                    
                    Android
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" >
            
                <span>
            
                    
                    框架
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.1" data-path="../android/框架/BlockCanary.html">
            
                <a href="../android/框架/BlockCanary.html">
            
                    
                    BlockCanary
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2" data-path="../android/框架/fresco.html">
            
                <a href="../android/框架/fresco.html">
            
                    
                    Fresco
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.3" data-path="../android/框架/Glide源码.html">
            
                <a href="../android/框架/Glide源码.html">
            
                    
                    Glide
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.4" data-path="../android/框架/LeakCanary原理.html">
            
                <a href="../android/框架/LeakCanary原理.html">
            
                    
                    LeakCanary
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.5" data-path="../android/框架/Retrofit源码.html">
            
                <a href="../android/框架/Retrofit源码.html">
            
                    
                    Retrofit源码
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.2" >
            
                <span>
            
                    
                    源码解析
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="../android/源码/Binder.html">
            
                <a href="../android/源码/Binder.html">
            
                    
                    Binder
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.2" data-path="../android/源码/Dialog源码.html">
            
                <a href="../android/源码/Dialog源码.html">
            
                    
                    Dialog源码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.3" data-path="../android/源码/RecycleView缓存机制.html">
            
                <a href="../android/源码/RecycleView缓存机制.html">
            
                    
                    RecycleView缓存机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.4" data-path="../android/源码/WMS源码.html">
            
                <a href="../android/源码/WMS源码.html">
            
                    
                    WMS源码
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.3" >
            
                <span>
            
                    
                    自定义View及效果
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.3.1" data-path="../android/自定义View及效果/触摸事件.html">
            
                <a href="../android/自定义View及效果/触摸事件.html">
            
                    
                    触摸事件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.2" data-path="../android/自定义View及效果/自定义ItemDecoration.html">
            
                <a href="../android/自定义View及效果/自定义ItemDecoration.html">
            
                    
                    自定义ItemDecoration
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.3" data-path="../android/自定义View及效果/ItemTouchHelper使用.html">
            
                <a href="../android/自定义View及效果/ItemTouchHelper使用.html">
            
                    
                    ItemTouchHelper
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.4" data-path="../android/自定义View及效果/MaterilaDesign布局使用.html">
            
                <a href="../android/自定义View及效果/MaterilaDesign布局使用.html">
            
                    
                    MaterilaDesign布局使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.4" >
            
                <span>
            
                    
                    Gradle
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.4.1" data-path="../android/Gradle/Gradle编译流程梳理.html">
            
                <a href="../android/Gradle/Gradle编译流程梳理.html">
            
                    
                    Gradle编译流程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.2" data-path="../android/Gradle/Transform使用.html">
            
                <a href="../android/Gradle/Transform使用.html">
            
                    
                    Transform使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.5" >
            
                <span>
            
                    
                    kotlin实践
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.5.1" data-path="../android/Kotlin/协程使用.html">
            
                <a href="../android/Kotlin/协程使用.html">
            
                    
                    协程初步使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../java/">
            
                <a href="../java/">
            
                    
                    Java
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../java/多线程同步.html">
            
                <a href="../java/多线程同步.html">
            
                    
                    多线程同步
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../java/垃圾回收机制.html">
            
                <a href="../java/垃圾回收机制.html">
            
                    
                    垃圾回收机制
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../计算机网络/">
            
                <a href="../计算机网络/">
            
                    
                    计算机网络
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../计算机网络/编码加密.html">
            
                <a href="../计算机网络/编码加密.html">
            
                    
                    编码加密算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../计算机网络/登陆认证.html">
            
                <a href="../计算机网络/登陆认证.html">
            
                    
                    登陆认证流程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../计算机网络/http协议.html">
            
                <a href="../计算机网络/http协议.html">
            
                    
                    http协议
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../操作系统/">
            
                <a href="../操作系统/">
            
                    
                    操作系统
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    设计模式
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.6.1" data-path="单例模式.html">
            
                <a href="单例模式.html">
            
                    
                    单例模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="建造者模式.html">
            
                <a href="建造者模式.html">
            
                    
                    建造者模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >单例模式</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h3 id="&#x5355;&#x4F8B;&#x6A21;&#x5F0F;">&#x5355;&#x4F8B;&#x6A21;&#x5F0F;</h3>
<h4 id="1-&#x5B8C;&#x5584;&#x7248;&#x61D2;&#x6C49;&#x5F0F;">1. &#x5B8C;&#x5584;&#x7248;&#x61D2;&#x6C49;&#x5F0F;</h4>
<pre><code>public class DataModel {
    //&#x9632;&#x6B62;&#x6307;&#x4EE4;&#x91CD;&#x6392;&#x5BFC;&#x81F4;&#x6570;&#x636E;&#x9519;&#x8BEF;

    private static volatile DataModel instance;
    //&#x6784;&#x9020;&#x51FD;&#x6570;&#x7684;&#x79C1;&#x6709;&#x5316;
    private DataModel(){

    }

    public static DataModel getInstance(){
        //&#x9632;&#x6B62;&#x4E0D;&#x5FC5;&#x8981;&#x7684;&#x9501;&#x64CD;&#x4F5C;
        if(instance!=null){
            return instance;
        }
        //&#x5355;&#x4E00;&#x8BBF;&#x95EE;
        synchronized(DataModel.class){
            if(instance==null){
                instance=new DataModel();
            }
            return instance;
        }
    }
}
</code></pre><h4 id="2-&#x997F;&#x6C49;&#x5F0F;">2. &#x997F;&#x6C49;&#x5F0F;</h4>
<pre><code>public class Singleton {  
    private static class SingletonHolder {  
                private static final Singleton INSTANCE = new Singleton();  
      }  
      private Singleton (){}
      public static final Singleton getInstance() {  
                return SingletonHolder.INSTANCE;  
      }


public enum Singleton {  
     INSTANCE;  
    public void whateverMethod() {  
     }  
}
</code></pre><h4 id="3&#x3001;&#x53CC;&#x91CD;&#x68C0;&#x67E5;&#x5F0F;">3&#x3001;&#x53CC;&#x91CD;&#x68C0;&#x67E5;&#x5F0F;</h4>
<pre><code>public class Singleton3 {
//&#x4F7F;&#x7528;volatile&#x5173;&#x952E;&#x5B57;&#x9632;&#x6B62;&#x91CD;&#x6392;&#x5E8F;&#xFF0C;&#x56E0;&#x4E3A; new Instance()&#x662F;&#x4E00;&#x4E2A;&#x975E;&#x539F;&#x5B50;&#x64CD;&#x4F5C;&#xFF0C;&#x53EF;&#x80FD;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x4E0D;&#x5B8C;&#x6574;&#x7684;&#x5B9E;&#x4F8B;
    private static volatile Singleton3 singleton3;
    private Singleton3() {
    }
    public static Singleton3 getSingleton3() {
        // Double-Check idiom
        if (singleton3 == null) {
            synchronized (Singleton3.class) { // 1
            // &#x53EA;&#x9700;&#x5728;&#x7B2C;&#x4E00;&#x6B21;&#x521B;&#x5EFA;&#x5B9E;&#x4F8B;&#x65F6;&#x624D;&#x540C;&#x6B65;
                if (singleton3 == null) { // 2
                    singleton3 = new Singleton3(); // 3
                }
           }
        }
        return singleton3;
    }
}
</code></pre><h4 id="4-&#x9759;&#x6001;&#x5185;&#x90E8;&#x7C7B;&#x5F0F;">4. &#x9759;&#x6001;&#x5185;&#x90E8;&#x7C7B;&#x5F0F;</h4>
<pre><code>public class Singleton5 {
// &#x79C1;&#x6709;&#x5185;&#x90E8;&#x7C7B;&#xFF0C;&#x6309;&#x9700;&#x52A0;&#x8F7D;&#xFF0C;&#x7528;&#x65F6;&#x52A0;&#x8F7D;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x5EF6;&#x8FDF;&#x52A0;&#x8F7D;
    private static class Holder {
        private static Singleton5 singleton5 = new Singleton5();
    }
    private Singleton5() {
    }
    public static Singleton5 getSingleton5() {
        return Holder.singleton5;
    }
}
</code></pre><h4 id="5-&#x679A;&#x4E3E;&#x7C7B;&#x5F0F;">5. &#x679A;&#x4E3E;&#x7C7B;&#x5F0F;</h4>
<pre><code>
public class EnumSingleton{
    private EnumSingleton(){}
    public static EnumSingleton getInstance(){
        return Singleton.INSTANCE.getInstance();
    }

    private static enum Singleton{
        INSTANCE;

        private EnumSingleton singleton;
        //JVM&#x4F1A;&#x4FDD;&#x8BC1;&#x6B64;&#x65B9;&#x6CD5;&#x7EDD;&#x5BF9;&#x53EA;&#x8C03;&#x7528;&#x4E00;&#x6B21;
        private Singleton(){
            singleton = new EnumSingleton();
        }
        public EnumSingleton getInstance(){
            return singleton;
        }
    }
}
</code></pre><h3 id="&#x6269;&#x5C55;">&#x6269;&#x5C55;:</h3>
<h4 id="1-&#x7531;&#x4E0D;&#x540C;&#x7684;&#x7C7B;&#x52A0;&#x8F7D;&#x5668;&#x52A0;&#x8F7D;&#x7C7B;&#x65F6;&#x4F1A;&#x5BFC;&#x81F4;&#x5355;&#x4F8B;&#x6A21;&#x5F0F;&#x7684;&#x5931;&#x6548;&#xFF0C;&#x4F8B;&#x5982;&#x8FDC;&#x7A0B;&#x8C03;&#x7528;&#x65F6;&#x3002;">1. &#x7531;&#x4E0D;&#x540C;&#x7684;&#x7C7B;&#x52A0;&#x8F7D;&#x5668;&#x52A0;&#x8F7D;&#x7C7B;&#x65F6;&#x4F1A;&#x5BFC;&#x81F4;&#x5355;&#x4F8B;&#x6A21;&#x5F0F;&#x7684;&#x5931;&#x6548;&#xFF0C;&#x4F8B;&#x5982;&#x8FDC;&#x7A0B;&#x8C03;&#x7528;&#x65F6;&#x3002;</h4>
<pre><code>  private static Class getClass(String classname) throws ClassNotFoundException {     
       ClassLoader classLoader = Thread.currentThread().getContextClassLoader();     
       if(classLoader == null) classLoader = Singleton.class.getClassLoader();     
       return (classLoader.loadClass(classname));     
  }     
`
</code></pre><h4 id="2&#x3001;&#x5982;&#x679C;singleton&#x5B9E;&#x73B0;&#x4E86;javaioserializable&#x63A5;&#x53E3;&#xFF0C;&#x90A3;&#x4E48;&#x8FD9;&#x4E2A;&#x7C7B;&#x7684;&#x5B9E;&#x4F8B;&#x5C31;&#x53EF;&#x80FD;&#x88AB;&#x5E8F;&#x5217;&#x5316;&#x548C;&#x590D;&#x539F;&#x3002;">2&#x3001;&#x5982;&#x679C;Singleton&#x5B9E;&#x73B0;&#x4E86;java.io.Serializable&#x63A5;&#x53E3;&#xFF0C;&#x90A3;&#x4E48;&#x8FD9;&#x4E2A;&#x7C7B;&#x7684;&#x5B9E;&#x4F8B;&#x5C31;&#x53EF;&#x80FD;&#x88AB;&#x5E8F;&#x5217;&#x5316;&#x548C;&#x590D;&#x539F;&#x3002;</h4>
<pre><code>  public class Singleton implements java.io.Serializable {     
     public static Singleton INSTANCE = new Singleton();     
     protected Singleton() {     
     }     
     private Object readResolve() {     
              return INSTANCE;     
    }    
}
</code></pre><h4 id="3-&#x53CD;&#x5C04;&#x521B;&#x5EFA;&#x65F6;&#x5BFC;&#x81F4;&#x5931;&#x6548;&#x3001;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x6807;&#x8BB0;&#x4F4D;&#x5728;&#x7B2C;&#x4E8C;&#x6B21;&#x521D;&#x59CB;&#x5316;&#x65F6;&#x76F4;&#x63A5;&#x629B;&#x51FA;&#x5F02;&#x5E38;">3. &#x53CD;&#x5C04;&#x521B;&#x5EFA;&#x65F6;&#x5BFC;&#x81F4;&#x5931;&#x6548;&#x3001;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x6807;&#x8BB0;&#x4F4D;&#x5728;&#x7B2C;&#x4E8C;&#x6B21;&#x521D;&#x59CB;&#x5316;&#x65F6;&#x76F4;&#x63A5;&#x629B;&#x51FA;&#x5F02;&#x5E38;</h4>
<pre><code>public class Singleton implements java.io.Serializable {     
    private boolean init = false;
    private Singleton() {     
            if(init){
                //&#x629B;&#x51FA;&#x5F02;&#x5E38;&#x5904;&#x7406;
                return;
            }
            init = true;
     }     
}
</code></pre><h4 id="4-&#x4F7F;&#x7528;&#x5BB9;&#x5668;&#x5B9E;&#x73B0;&#x5355;&#x4F8B;&#x6A21;&#x5F0F;&#x3001;&#x53EF;&#x4EE5;&#x7EDF;&#x4E00;&#x7BA1;&#x7406;&#x548C;&#x7EDF;&#x4E00;&#x63A5;&#x53E3;&#x83B7;&#x53D6;&#x5355;&#x4F8B;">4. &#x4F7F;&#x7528;&#x5BB9;&#x5668;&#x5B9E;&#x73B0;&#x5355;&#x4F8B;&#x6A21;&#x5F0F;&#x3001;&#x53EF;&#x4EE5;&#x7EDF;&#x4E00;&#x7BA1;&#x7406;&#x548C;&#x7EDF;&#x4E00;&#x63A5;&#x53E3;&#x83B7;&#x53D6;&#x5355;&#x4F8B;</h4>
<pre><code>public class Service {   
    private static HashMap&lt;String, Object&gt; singleInstances = new HashMap&lt;&gt;();   
    private Service() {    }       
    public static Object getSingleInstances(String key) {        
        synchronized (Service.class) {
            if(!singleInstances.containsKey(key)) {              
                singleInstances.put(key, singleObject);            
            }         
            return singleInstances.get(key);        
        }    
    }
}
</code></pre><h4 id="5-&#x53CC;&#x91CD;&#x68C0;&#x6D4B;&#x5F0F;dlc&#x4F1A;&#x51FA;&#x73B0;&#x7684;&#x95EE;&#x9898;">5. &#x53CC;&#x91CD;&#x68C0;&#x6D4B;&#x5F0F;DLC&#x4F1A;&#x51FA;&#x73B0;&#x7684;&#x95EE;&#x9898;:</h4>
<hr>
<p>&#x7531;&#x4E8E;JVM&#x5185;&#x5B58;&#x5206;&#x914D;&#x6A21;&#x578B;&#xFF0C;&#x7C7B;&#x5728;&#x521D;&#x59CB;&#x5316;&#x65F6;&#x4F1A;&#x5206;&#x4E3A;3&#x90E8;&#x5206;:</p>
<ul>
<li>&#x4E3A;&#x7C7B;&#x5B9E;&#x4F8B;&#x5206;&#x914D;&#x7A7A;&#x95F4;</li>
<li>&#x8C03;&#x7528;&#x7C7B;&#x7684;&#x6784;&#x9020;&#x51FD;&#x6570;</li>
<li>&#x4E3A;&#x7C7B;&#x7684;&#x6210;&#x5458;&#x53D8;&#x91CF;&#x5206;&#x914D;&#x7A7A;&#x95F4;&#xFF08;&#x6B64;&#x65F6;&#x7C7B;&#x5B9E;&#x4F8B;&#x90E8;&#x4F4D;&#x7A7A;&#xFF09;</li>
</ul>
<hr>
<p>&#x5728;JVM&#x5185;&#x5B58;&#x6A21;&#x578B;&#x4E2D;&#x4F1A;&#x4F18;&#x5316;&#x7F16;&#x8BD1;&#x5BFC;&#x81F4;&#x4E71;&#x5E8F;&#x6267;&#x884C;&#xFF0C;&#x6709;&#x53EF;&#x80FD;&#x9996;&#x5148;&#x4E3A;&#x7C7B;&#x7684;&#x6210;&#x5458;&#x53D8;&#x91CF;&#x5206;&#x914D;&#x4E86;&#x7A7A;&#x95F4;&#x4E8C;&#x6CA1;&#x6709;&#x8C03;&#x7528;&#x6784;&#x9020;&#x51FD;&#x6570;&#xFF0C;&#x6B64;&#x65F6;&#x53E6;&#x5916;&#x4E00;&#x4E2A;&#x8FDB;&#x7A0B;&#x8FDB;&#x5165;&#x65F6;&#x5728;&#x7B2C;&#x4E00;&#x5C42;&#x5224;&#x7A7A;&#x65F6;&#x8FD4;&#x56DE;&#x4E86;&#x8FD9;&#x4E2A;&#x8FD8;&#x6CA1;&#x6709;&#x5B8C;&#x5168;&#x521D;&#x59CB;&#x5316;&#x7684;&#x7C7B;&#x5B9E;&#x4F8B;&#xFF0C;&#x5BFC;&#x81F4;&#x8C03;&#x7528;&#x51FA;&#x9519;&#x3002;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                
                <a href="建造者模式.html" class="navigation navigation-next navigation-unique" aria-label="Next page: 建造者模式">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"layout":"post","title":"单例模式","subtitle":" 单例模式实现","date":"2020-01-02T20:03:00.000Z","author":"hzy","//header-img":"img/post-bg-2015.jpg","catalog":true,"tags":["设计模式"],"level":"1.6.1","depth":2,"next":{"title":"建造者模式","level":"1.6.2","depth":2,"path":"设计模式/建造者模式.md","ref":"设计模式/建造者模式.md","articles":[]},"previous":{"title":"设计模式","level":"1.6","depth":1,"ref":"","articles":[{"title":"单例模式","level":"1.6.1","depth":2,"path":"设计模式/单例模式.md","ref":"设计模式/单例模式.md","articles":[]},{"title":"建造者模式","level":"1.6.2","depth":2,"path":"设计模式/建造者模式.md","ref":"设计模式/建造者模式.md","articles":[]}]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"设计模式/单例模式.md","mtime":"2020-02-13T02:17:30.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-03-13T16:08:39.790Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

